package com.tjsinfo.tjsoa.system.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.system.bo.ISystemUserBo;

public class IsSameUserNameAction extends Action{
	private ISystemUserBo systemUserBo;

	public ISystemUserBo getSystemUserBo() {
		return systemUserBo;
	}

	public void setSystemUserBo(ISystemUserBo systemUserBo) {
		this.systemUserBo = systemUserBo;
	}

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
	
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		//String loginname = new String(request.getParameter("loginname").getBytes("ISO-8859-1"),"UTF-8");
		String loginname = request.getParameter("username");
		if (systemUserBo.isSameUserName(loginname)) {
			response.getWriter().print(false);
		} else {
			response.getWriter().print(true);
		}
		return null;
	}
	
	
}


